import request from '@/utils/request'

export function getMenusTree() {
  return request({
    url: 'back/mMenu/tree',
    method: 'get'
  })
}
export function getDetail(id) {
  return request({
    url: '/back/mMenu/getByID',
    method: 'get',
    params: { id }
  })
}
export function saveMenu(data) {
  return request({
    url: 'back/mMenu',
    method: 'post',
    data
  })
}
export function buildMenus() {
  return request({
    url: 'back/mMenu/build',
    method: 'get'
  })
}
export function getMenus() {
  return request({
    url: 'back/mMenu',
    method: 'get'
  })
}

export function delMenu(id) {
  return request({
    url: 'back/mMenu/'+id,
    method: 'delete'
  })
}
export function getMenuResources(id) {
  return request({
    url: 'back/mMenu/resources/'+id,
    method: 'get'
  })
}

export default { delMenu, getMenusTree,  getDetail,saveMenu,getMenus,getMenuResources}
